package com.drools.demo.runner;

import com.drools.demo.entity.Logistics;
import com.drools.demo.entity.Person;
import com.drools.demo.server.*;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author czq
 * @Package com.drools.demo
 * @Date 2024/8/26 12:10
 * @description:
 */
@Component
public class StartRunner implements ApplicationRunner {
//    @Resource
//    private PersonService personService;
//    @Resource
//    private ListService listService;
//    @Resource
//    private List2Service list2Service;
//    @Resource
//    private List3Service list3Service;
//    @Resource
//    private QueryService queryService;
//    @Resource
//    private FunctionService functionService;
    @Resource
    private ExtendsService extendsService;

    @Override
    public void run(ApplicationArguments args) {
        extendsService.executeRules();
    }

}

/*
 Person person = new Person();
        person.setId(1);
        person.setAge(18);
        person.setName("张三");
        person = personService.calculate(person);
        System.out.println(person);
 */
 /*
         Person person = new Person();
        person.setId(1);
        person.setAge(18);
        person.setName("张三");
        person = personService.calculateRule1(person);
        System.out.println(person);

        person = personService.calculateRule2(person);
        System.out.println(person);
         */
/*
 List<String> list = new ArrayList<>();
       list.add("1");
       list.add("666");
       list.add("2");
       list.add("3");
       listService.calculate(list);
        System.out.println("筛选后集合："+listService.getAfterFilterElements());
 */

/*
List<String> list = new ArrayList<>();
        list.add("1");
        list.add("4");
        list.add("3");
        list.add("2");

        // 添加一个匹配的元素
        List<String> listForCheck = new ArrayList<>(list);
        listForCheck.add("elementToCheck");

        list2Service.executeRules(listForCheck, "5");
 */